package savet.gui.dialogos;

import savet.gui.modelos.ListaLegendaModel;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JList;

/**
 *
 * @author Adisson Marinho
 */
public class CheckListClick extends MouseAdapter {

    @Override
    public void mouseClicked(MouseEvent event) {
        JList list = (JList) event.getSource();
        
        // Get index of item clicked
        int index = list.locationToIndex(event.getPoint());
        ListaLegendaModel model = (ListaLegendaModel) list.getModel();
        model.setSelecaoLegenda(index);

        // Repaint cell
        System.out.println("Mouse clicked...");
        list.repaint(list.getCellBounds(index, index));
    }
}
